<template>
  <div class="shop-info">
    <div class="logo">
      <span><img :src="shopInfo.logo" alt=""/></span>
      <span class="sname">{{ shopInfo.name }}</span>
    </div>

    <div class="shop-desc">
      <div class="shop-num">
        <div class="sells">
          <p>{{ totalSells }}万</p>
          <p class="desc-text">总销量</p>
        </div>
        <div class="count">
          <p>{{ shopInfo.goodsCount }}</p>
          <p class="desc-text">全部宝贝</p>
        </div>
      </div>

      <div class="shop-score">
        <ul v-for="(item, index) in shopInfo.score" :key="index">
          <li>
            <span>{{ item.name }}</span>
            <span
              :class="{ scorePink: item.isBetter, scoreGreen: !item.isBetter }"
              >{{ item.score }}</span
            >
            <span
              :class="{ textPink: item.isBetter, textGreen: !item.isBetter }"
              >{{ item.isBetter ? "高" : "低" }}</span
            >
          </li>
        </ul>
      </div>
    </div>
    <div class="goShop"><a href="javascript:;">进店逛逛 </a></div>
  </div>
</template>

<script>
export default {
  name: "DetailShopInfo",
  props: {
    shopInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    totalSells() {
      return (this.shopInfo.sells / 10000).toFixed(1);
    },
  },
};
</script>

<style scoped>
/* div {
  border: 1px solid red;
} */
.logo {
  margin: 30px 0 0 10px;
  font-size: 18px;
}
.logo img {
  width: 20%;
  vertical-align: middle;
}
.logo .sname {
  padding-left: 15px;
}
.shop-desc {
  display: flex;
  justify-content: space-between;
  margin: 40px 0 0 30px;
}
.shop-num {
  width: 50%;
  display: flex;
  justify-content: space-between;
  text-align: center;
  border-right: 1px solid #eee;
  height: 50px;
  margin-top: 10px;
}
.sells,
.count {
  width: 50%;
  font-size: 20px;
  font-weight: 700;
}

.desc-text {
  font-size: 14px;
  font-weight: 400;
  margin-top: 10px;
}
.shop-score {
  width: 50%;
  margin-left: 30px;
}
.shop-score li {
  padding-bottom: 5px;
}
.shop-score li span:nth-child(-n + 2) {
  padding-right: 15px;
}

.scorePink {
  color: var(--color-tint);
}
.scoreGreen {
  color: green;
}
.textPink {
  background: var(--color-tint);
  color: #fff;
}
.textGreen {
  background: green;
  color: #fff;
}
.goShop {
  margin: 30px auto;
  width: 25%;
  font-size: 18px;
  padding: 10px 0;
  border-radius: 10px;
  text-align: center;
  background: #eee;
}
</style>
